package com.dszq.article.feign;

import com.dszq.apis.article.IArticleClient;
import com.dszq.article.service.ApArticleService;
import com.dszq.model.article.dtos.ArticleDto;
import com.dszq.model.common.dtos.ResponseResult;
import feign.Param;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * [一句话描述该类的功能]
 *
 * @author : [Lenovo]
 * @version : [v1.0]
 * @createTime : [2024/4/21 16:28]
 */
@RestController
public class ArticleClient implements IArticleClient {
    @Autowired
    private ApArticleService apArticleService;
    /**
     * @param articleDto
     * @return
     */
    @Override
    @PostMapping("/api/v1/article/save")
    public ResponseResult saveArticle(ArticleDto articleDto) {
        return apArticleService.saveArticle(articleDto);
    }
    /**
     * 删除文章
     *
     * @param id 文章ID，通过URL路径变量传递
     * @return 返回操作结果，包括操作是否成功、错误代码和错误信息等
     */
    @GetMapping("/api/v1/article/del_art/{articleId}")
    public ResponseResult deleteArticle(@PathVariable("articleId") Long id)
    {
        // 调用服务层方法，删除指定ID的文章
        return apArticleService.deleteArticle(id);
    }
}
